﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.ComponentModel;
using System.Collections.Generic;
using System.Windows.Data;
using System.IO;
using System.Linq;

using Cinch;
using MEFedMVVM.ViewModelLocator;
using MEFedMVVM.Services.Contracts;
using MEFedMVVM.Common;


namespace Anata.Client
{
    /// <summary>
    /// </summary>
    public class KonsumenAddViewModel : ViewModelBase
    {
        #region Data
        #region Data.Primitives
        #endregion

        #region Data.Rules
        #endregion

        #region Data.VMs
        private KonsumenViewModel currentKonsumen;
        #endregion

        #region Data.Services
        private IMessageBoxService messageBoxService;
        private IUIVisualizerService uiVisualizerService;
        #endregion
        #endregion

        #region Constructor
        [ImportingConstructor]
        public KonsumenAddViewModel(
            IMessageBoxService messageBoxService,
            IUIVisualizerService uiVisualizerService)
        {
            #region Constructor.SetupServices
            this.messageBoxService = messageBoxService;
            this.uiVisualizerService = uiVisualizerService;
            #endregion

            #region Constructor.SetupCommands
            KonsumenBaruCommand = new SimpleCommand<Object, Object>(ExecuteKonsumenBaruCommand);
            #endregion

            #region Constructor.SetupDataWrappers
            #endregion

            #region Constructor.SetupValidationRules
            #endregion

            #region Constructor.SetupVMs
            CurrentKonsumen = new KonsumenViewModel(
                messageBoxService,
                uiVisualizerService,
                null,
                null,
                null);
            #endregion
        }
        #endregion

        #region Public Properties
        #region Public.Commands
        public SimpleCommand<Object, Object> KonsumenBaruCommand { get; private set; }
        #endregion

        #region Public.ViewMode
        #endregion

        #region Public.Data
        #endregion

        #region Public.CachedCollection
        #endregion

		#region Public.DataVMs
        /// <summary>
        /// </summary>
        static PropertyChangedEventArgs currentKonsumenChangeArgs =
            ObservableHelper.CreateArgs<KonsumenAddViewModel>(x => x.CurrentKonsumen);

        public KonsumenViewModel CurrentKonsumen
        {
            get { return currentKonsumen; }
            set
            {
                currentKonsumen = value;
                NotifyPropertyChanged(currentKonsumenChangeArgs);
            }
        }
        #endregion
        #endregion

        #region Command Handlers
        /// <summary>
        /// </summary>
        private void ExecuteKonsumenBaruCommand(Object args)
        {
            if (currentKonsumen.IsValid)
            {
                CloseActivePopUpCommand.Execute(true);
            }
        }

        #endregion

        #region IViewStatusAwareInjectionAware Members

        //public void InitialiseViewAwareService(IViewAwareStatus viewAwareStatusService)
        //{
        //    this.ViewAwareStatusService = viewAwareStatusService;
        //    //this.ViewAwareStatusService.ViewLoaded += ViewAwareStatusService_ViewLoaded;
        //}
        #endregion
        
        #region Private Methods
        //private void ViewAwareStatusService_ViewLoaded()
        //{
        //    LoadedKonsumenFilterViewModel = new KonsumenFilterViewModel(
        //        uiVisualizerService,
        //        ViewAwareStatusService);
        //}

        #endregion
    }

}
